package com.gaojiawei.multiThread14_ConcurrentHashMap;

import java.util.concurrent.ConcurrentHashMap;

/**
 * replace method
 */
public class L05_ConcurrentHashMapReplaceMethod {
    public static void main(String[] args) {
        ConcurrentHashMap<String,Integer> concurrentHashMap = new ConcurrentHashMap<>();
        concurrentHashMap.put("key",1);

        concurrentHashMap.replace("key",1,2);
        concurrentHashMap.replace("key",1,3);
        System.out.println(concurrentHashMap);

        concurrentHashMap.replace("key",3);
        System.out.println(concurrentHashMap);

    }
}
